<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String id=request.getParameter("id");
String type=request.getParameter("type");
String floor=request.getParameter("floor");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<script type="text/javascript" src="<%=basePath%>js/tracking.js"
	charset="utf-8"></script>
<script id="allmobilize" charset="utf-8"
	src="<%=basePath%>js/allmobilize.min.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="<%=basePath%>js/jquery.cookie.js" type="text/javascript"></script>

<link rel="stylesheet" href="<%=basePath%>css/index.css">
<!--new top-->

<link rel="Stylesheet" type="text/css"
	href="<%=basePath%>css/style.css" />
<link type="text/css" rel="stylesheet" href="<%=basePath%>css/blue.css" />
<link type="text/css" rel="stylesheet" href="<%=basePath%>css/common.css" />



</head>
<body>

<div id="panel_report">
    <div class="panel_head">不良信息举报</div>
    <form method="post" id="frmReport" class="panel_body">
    <table border="0" cellpadding="0" cellspacing="4" class="pop_table">
        <tr><td colspan="2">您举报的评论来自文章：<a href='http://blog.csdn.net/gaoshouxiaodi/article/details/45556579' target=_blank>Android 自定义可拖拽ListView，思想最重要。</a></td></tr>
        <tr>
            <th style="width:60px;">举报原因：</th>
            <td id="panel_reporttype">
                        <label><input type="radio" class="report_type" id="report_sex" name="report_type"  value="1" />色情</label>
                        <label><input type="radio" class="report_type" id="report_Politics" name="report_type"  value="2" />政治</label>
                        <label><input type="radio" class="report_type" id="report_ad" name="report_type"  value="4" />广告</label>
                        <label><input type="radio" class="report_type" id="report_want" name="report_type"  value="5" />招聘</label>
                        <label><input type="radio" class="report_type" id="report_call" name="report_type"  value="6" />骂人</label>
                    <br /> 
                        <label><input type="radio" class="report_type" id="report_other" name="report_type"  value="7" />其他</label>
            <input type="text" name="report_other_content" id="report_other_content" maxlength="30" style="display: none;" />
            </td>
        </tr>
        <tr id="panel_originalurl" style="display: none;">
            <th>原文地址：</th>
            <td>
                <input id="originalurl" value="http://" name="originalurl" type="text" style="width: 90%;" />
            </td>
        </tr>
        <tr>
            <th id="sp_reason">原因补充：</th>
            <td>
                <textarea id="report_description" style="width: 300px;" rows="3" name="report_description">顶</textarea>
                <p id="sp_n" style="color:#999;margin:0px;padding:0px;">(最多只允许输入30个字)</p>
            </td>
        </tr>
        <tr>
            <td></td>
            <td>
                <input id="btnSubmitReport" name="submit" type="image" align="middle" class="btn_1" src="http://static.blog.csdn.net/images/btn_submit.jpg" />
                <span style="padding-left:20px;"></span>
                <img id="btnCloseReportDialog" src="http://static.blog.csdn.net/images/btn_cancel.jpg" align="middle" />
                <div id="error" style="color: Red">
                </div>
            </td>
        </tr>
    </table>   
    </form>
</div>
<script src="<%=basePath%>js/jquery.js" type="text/javascript"></script>
<script type="text/javascript" src="<%=basePath%>js/cnick.js"></script>
<script type="text/javascript" src="<%=basePath%>js/newblog.min.js"></script>
<script language="javascript" type="text/javascript">
var isComment=1;
    //显示隐藏地址
    $(function () {
        if(isComment){
            $("#report_description").attr("disabled",true);
            $("#sp_n").hide();
            $("#sp_reason").html("评论内容：");
        }
        $(".report_type").click(function () {
            $("#panel_originalurl,#report_other_content").hide();
            switch ($(this).val()) {
                case '3':
                    $("#panel_originalurl").show();
                    $("#originalurl").focus();
                    break;
                case '7':
                    if(isComment){
                        $("#report_other_content").show().focus();
                    }
                    break;
            }

        });

        $("#frmReport").submit(function () {
            if (!currentUserName) {

                if (confirm("您的操作必须登录，是否登录？")) {
                    location.href = "http://passport.csdn.net/account/login?from=" + encodeURIComponent(location.href);
                    return false;
                }
                return false;
            }

            var reportType = $("input[name=report_type]:checked").val();
            if(!reportType){
                alert("请选择举报原因！");
                return false;
            }
            var otherInfo = "";
            switch (reportType) {
                case '3':
                    otherInfo = $("#originalurl").val();
                    if (otherInfo == ""||otherInfo=="http://") {
                        alert("举报抄袭必须提供原创文章地址！");
                        $("#originalurl").focus();
                        return false;
                    } else if(!checkeURL(otherInfo)) {
                        alert("请输入正确的原创文章地址！");
                        $("#originalurl").focus();
                        return false;
                    }
                    break;
                case '7':
                    otherInfo = $("#report_other_content").val();
                    if (isComment && !otherInfo) {
                        alert("请填写举报的具体原因！");
                        $("#report_other_content").focus();
                        return false;
                    }
                    if(!isComment){
                        if(!$("#report_description").val()){
                            alert("请填写举报的具体原因！");
                            $("#report_description").focus();
                            return false;
                        }
                    }
                    break;
            }
            if(!isComment){
                if($("#report_description").val().length>30){
                    alert("举报原因最多只允许输入30个字！");
                    return false;
                }
            }
            
            var data = { 
                articleId: 45556579,
                commentId: 5024321,
                reportType: reportType, 
                originalurl: $("#originalurl").val(), 
                report_other_content: $("#report_other_content").val(), 
                report_description: $("#report_description").val(), 
                currentUserName: currentUserName, 
                updatetime: "2015/5/7 16:05:42", 
                blogUser: "ElinaVampire" 
            };
            if(!isComment){//如果是举报文章
                data.report_other_content = data.report_description;
                data.report_description = "最近好多小伙伴都结婚了，甚至还有二婚的，我终于总结出为什么如此热爱生活的同时，钱包却一直不见涨的原因。想想以后的日子，结婚的生孩子，二婚的生孩子，然后有的结婚，有的二婚，有的多婚。。深深感叹：时不我待啊！！！&#160; &#160; &#160; &#160; 高中老师的谆谆教诲，一直牢记在心中，那时他说：兔子不是窝边草，你看看你们，都在自己班级处对象！那时看他痛心疾首，一副恨铁不成钢的样子，使我深有感触，一直坚持到现在。最近受伙";
            }

            $.post(blog_address + "/common/report?id=5024321&t=3", data, function (data) {
                if (data.result == 1){
                    SetError("感谢您的举报，我们会尽快审核！");
                }else{
                    if (data.content) alert(data.content);
                }
                
            });
            return false;
        });

        $("#btnCloseReportDialog").click(function () {
            CloseDiv();
        });
        
    });

    //提示后关闭方法
    function SetError(error) {
        $("#btnCloseReportDialog").trigger("click");
        alert(error);
        CloseDiv();
    }

    //关闭方法
    function CloseDiv() {

        $.removeMask();
        $("#report_dialog").hide().html("");
        return false;
    }

    //验证url
    function checkeURL(url){
        return /^http(s)?:\/\/([\w-]+\.)+[\w-]+/i.test(url);
    }
</script>
</body>
</html>
